package com.example.contrller.dev;

import com.alibaba.fastjson.JSON;
import com.example.biz.BacenUser.IBacenUserbiz;
import com.example.biz.DevUser.IDevUserbiz;

import com.example.pojo.DataDictionary;
import com.example.pojo.DevUser;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;


@Controller
@RequestMapping("/dev")
public class DevUserController {
    @Resource
    private IDevUserbiz biz;

    @Resource
    private IBacenUserbiz biz1;

    @PostMapping("devUser")
    public String Login(String devCode, String devPassword, HttpSession session) {
        DevUser user = biz.findDevUser(devCode);
        if (user == null || !user.getDevPassword().equals(devPassword)) {
            return "dev/login";
        }
        session.setAttribute("devUserr", user);
        return "dev/DeveLoper";
    }






    @RequestMapping("LogOut")
    public String LogOut(HttpSession session) {
        session.removeAttribute("backenUser");
        return "dev/login";
    }


}
